function [indian_data,indian_padding,train_num,zero_num,neibour_num,test_num]=...
    Mugnet_indian_preprossing(indian_pines,indian_pines_gt)

fprintf('\n ====== MugNet Preprossing ======= \n')

indian_pines=indian_pines(:,:,[1:103 109:149 164:219]);%remove the water absorbtion band
indian_padding=zeros(147,147,200);
%% zeros padding
%indian_padding(2:end-1,2:end-1,:)=indian_pines;
%% Expanding a circle outside the boundary
% indian_padding(2:end-1,2:end-1,:)=indian_pines;
% %four edges
% indian_padding(1,2:end-1,:)=indian_pines(1,:,:);
% indian_padding(end,2:end-1,:)=indian_pines(end,:,:);
% indian_padding(2:end-1,1,:)=indian_pines(:,1,:);
% indian_padding(2:end-1,end,:)=indian_pines(:,end,:);
% %four corners
% indian_padding(1,1,:)=indian_pines(1,1,:);
% indian_padding(1,end,:)=indian_pines(1,end,:);
% indian_padding(end,1,:)=indian_pines(end,1,:);
% indian_padding(end,end,:)=indian_pines(end,end,:);
%% Filping the image(equal to Expanding...)
indian_padding_plane=zeros(3*size(indian_pines,1),3*size(indian_pines,2),size(indian_pines,3));
indian_padding_plane=[rot90(indian_pines,2) flipud(indian_pines) rot90(indian_pines,2);...
                      fliplr(indian_pines) indian_pines fliplr(indian_pines);...
                      rot90(indian_pines,2) flipud(indian_pines) rot90(indian_pines,2)];

indian_padding=indian_padding_plane(size(indian_pines,1):2*size(indian_pines,1)+1,...
                                    size(indian_pines,2):2*size(indian_pines,2)+1,:);
%% train_num & zero_num
indian_pine=reshape(indian_pines,145*145,200);
indian_gt=reshape(indian_pines_gt,145*145,1);
seqence=1:145*145;
indian_data=[indian_pine indian_gt seqence'];%data+gt+num
indian_train=[];
for i=1:16
    if i==1
        temp=indian_data(indian_data(:,end-1)==i,:);%data in same class
        rand_num=randperm(size(temp,1));
        train_data=temp(rand_num(1:20),:);% 20 samples
        indian_train=train_data;
    else
        temp=indian_data(indian_data(:,end-1)==i,:);%data in same class
        rand_num=randperm(size(temp,1));
        train_data=temp(rand_num(1:20),:);
        indian_train=[indian_train;train_data];
    end
end
train_num=indian_train(:,end);%sequence,same as row
zero_num=indian_data(indian_data(:,end-1)==0,end);%background
train_num_all=[train_num;zero_num];
%train_num_all=unique(train_num_all);%training number set
%% neibour_num & test_num
neibour_num=[];
counter=0;
for i=1:size(train_num_all,1)
    lie=ceil(train_num_all(i,1)/145);
    hang=train_num_all(i,1)-145*(lie-1);%1-D to row/col
    for j=-1:1
        for k=-1:1
            if hang+j<1 || hang+j>145 || lie+k<1 || lie+k>145%out of the image
                continue;
            else
                counter=counter+1;
                if counter==1
                    temp_num=(lie+k-1)*145+hang+j;
                    neibour_num=temp_num;
                else
                    temp_num=(lie+k-1)*145+hang+j;
                    neibour_num=[neibour_num;temp_num];
                end
            end
        end
    end
end
neibour_num=unique(neibour_num);%neibourhood number set,same as row
indian_data_exceptzero=indian_data(indian_data(:,end-1)~=0,:);
test_num=setdiff(indian_data_exceptzero(:,end),neibour_num);%test number set, same seqence as rows
end